package com.qk.management.mapper;

import com.qk.dto.role.RoleDTO;
import com.qk.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper {
    List<Role> getRoles(RoleDTO roleDTO);

    @Delete("DELETE FROM role WHERE id = #{id}")
    void delete(Integer id);

    @Insert("INSERT INTO role(name,label,remark,create_time,update_time) VALUES(#{name},#{label},#{remark},#{createTime},#{updateTime})")
    void insert(Role role);

    @Select("SELECT * FROM role WHERE id = #{id}")
    Role selectById(Integer id);

    @Insert("UPDATE role SET name=#{name},label=#{label},remark=#{remark},update_time=#{updateTime} WHERE id=#{id}")
    void update(Role role);
    @Select("SELECT * FROM role")
    List<Role> selectList();
}